package TestObjects;

import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;
import java.util.ArrayList;

import GameObjects.Instances.Instance;
import GameObjects.Instances.Instances;
import GameObjects.Physics.Position;
import GameObjects.Ships.Alien.AlienShip;
import GameObjects.Ships.Engines.ShipEngine;
import GameObjects.Ships.HyperDrives.HyperDrive;
import GameObjects.Ships.Reactors.Reactor;
import GameObjects.Ships.Sheilds.Sheilds;
import GameObjects.Ships.Weapon.Weapon;

/**
 * This will be the Ship we do all testing on, people can make other test ships to avoid
 * collisions and that but this one is the base modal for testing new ships
 * @author Henry
 *
 */

public class TestAlienShip extends AlienShip 
{	
	private static final Instances instances = makeInstances();
	
	public TestAlienShip(double x, double y, double theta) 
	{
		super(instances, new Position(x, y, theta), /*Weapon energy*/100, /*Engine energy*/100);
	}
	
	private static Instances makeInstances()
	{
		Polygon bounds = new Polygon();
		
		bounds.addPoint(40, 80);
		bounds.addPoint(0, 0);
		bounds.addPoint(50, 0);
		bounds.addPoint(150, 50);
		bounds.addPoint(300, 60);
		bounds.addPoint(300, 100);
		bounds.addPoint(150, 110);
		bounds.addPoint(50, 160);
		bounds.addPoint(0, 160);
		
		Rectangle rect = bounds.getBounds();
		Instance inst = new Instance(null, rect.width, rect.height, bounds);
		ArrayList<Instance> instsa = new ArrayList<Instance>();
		instsa.add(inst);
		return new Instances(instsa, 1);
	}

	@Override
	protected ArrayList<ShipEngine> addEngines()
	{
		TestEngine engine = new TestEngine(new Position(-90, -60, 0));
		ArrayList<ShipEngine> shipEngines = new ArrayList<ShipEngine>(1);
		shipEngines.add(engine);
		engine = new TestEngine(new Position(-90, 60, 0));
		shipEngines.add(engine);
		return shipEngines;
	}

	@Override
	protected HyperDrive addHyperDrive() 
	{
		TestHyperDrive hyperDrive = new TestHyperDrive(new Position(-100, 0, 0));
		return hyperDrive;
	}

	@Override
	protected Reactor addReactor() 
	{
		Shape bounds = new Ellipse2D.Double(0, 0, 20, 20);
		Instance inst = new Instance(null, 20, 20, bounds);
		ArrayList<Instance> instsa = new ArrayList<Instance>();
		instsa.add(inst);
		Reactor reactor = new Reactor(new Instances(instsa, 1), new Position(0, 0, 0), 100, 10, 1000);
		
		return reactor;
	}

	@Override
	protected Sheilds addSheild() 
	{
		Shape bounds = new Ellipse2D.Double(0, 0, 500, 220);
		Instance inst = new Instance(null, 500, 220, bounds);
		ArrayList<Instance> instsa = new ArrayList<Instance>();
		instsa.add(inst);
		TestSheild enegerySheild = new TestSheild(new Instances(instsa, 1), new Position(0, 0, 0), 100, 1);
		
		return enegerySheild;
	}

	@Override
	protected ArrayList<Weapon> addWeapons() 
	{
		ArrayList<Weapon> weapons = new ArrayList<Weapon>();
		weapons.add(new TestWeapon(120, -30, 0, 100));
		weapons.add(new TestWeapon(120, 30, 0, 100));
		
		return weapons;
	}
}

